package com.xinke.module.system.mapper.sms;

import java.util.*;

import com.xinke.component.common.pojo.PageResult;
import com.xinke.component.mybatis.mybatis.core.query.LambdaQueryWrapperExt;
import com.xinke.component.mybatis.mybatis.core.mapper.BaseMapperExt;
import com.xinke.module.system.model.entity.sms.SmsTemplateDO;
import org.apache.ibatis.annotations.Mapper;
import com.xinke.module.system.model.vo.sms.*;

/**
 * 短信模板 Mapper
 *
 * @author yzx
 */
@Mapper
public interface SmsTemplateMapper extends BaseMapperExt<SmsTemplateDO> {

    default PageResult<SmsTemplateDO> selectPage(SmsTemplatePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperExt<SmsTemplateDO>()
                .eqIfPresent(SmsTemplateDO::getTemplateType, reqVO.getTemplateType())
                .eqIfPresent(SmsTemplateDO::getTemplateStatus, reqVO.getTemplateStatus())
                .eqIfPresent(SmsTemplateDO::getTemplateCode, reqVO.getTemplateCode())
                .likeIfPresent(SmsTemplateDO::getTemplateName, reqVO.getTemplateName())
                .eqIfPresent(SmsTemplateDO::getTemplateContent, reqVO.getTemplateContent())
                .eqIfPresent(SmsTemplateDO::getTemplateParams, reqVO.getTemplateParams())
                .eqIfPresent(SmsTemplateDO::getRemark, reqVO.getRemark())
                .eqIfPresent(SmsTemplateDO::getApiTemplateId, reqVO.getApiTemplateId())
                .eqIfPresent(SmsTemplateDO::getChannelId, reqVO.getChannelId())
                .eqIfPresent(SmsTemplateDO::getChannelCode, reqVO.getChannelCode())
                .orderByDesc(SmsTemplateDO::getTemplateId));
    }

}